/*
 * @(#)OTS.java	1.0 2000/12/14
 *
 * Copyright 2000 Thomas Barnekow. All Rights Reserved.
 *
 * This software is the proprietary information of Thomas Barnekow.
 * Use is subject to license terms.
 */

package tb.jots;

import tb.jots.impl.*;

/**
 * This is a static utility class serving as the <i>main entry point</i> for the
 * JOTS. It defines codes corresponding to the ones specified by the
 * <code>Status</code> and <code>Vote</code> enumerations of the <code>CosTransactions</code>
 * module. Further, it is used to get the calling {@link Thread}'s current
 * transaction (see {@link #getCurrent}.)
 *
 * @author Thomas Barnekow
 * @version 1.0
 */
public class OTS {

  /*
	 * Enum Vote
	 */

  /**
   * Code <code>VoteCommit</code> defined by the <code>CosTransactions::Vote</code>
   * enumeration.
   */
	public static final int VOTE_COMMIT = 0;

  /**
   * Code <code>VoteRollback</code> defined by the <code>CosTransactions::Vote</code>
   * enumeration.
   */
	public static final int VOTE_ROLLBACK	= 1;

  /**
   * Code <code>VoteReadOnly</code> defined by the <code>CosTransactions::Vote</code>
   * enumeration.
   */
	public static final int VOTE_READ_ONLY = 2;

	/*
	 * enum Status
	 */

  /**
   * Code <code>StatusActive</code> defined by the <code>CosTransactions::Status</code>
   * enumeration.
   */
	public static final int STATUS_ACTIVE = 0;

  /**
   * Code <code>StatusMarkedRollback</code> defined by the <code>CosTransactions::Status</code>
   * enumeration.
   */
	public static final int STATUS_MARKED_ROLLBACK = 1;

  /**
   * Code <code>StatusPrepared</code> defined by the <code>CosTransactions::Status</code>
   * enumeration.
   */
	public static final int STATUS_PREPARED = 2;

  /**
   * Code <code>StatusCommitted</code> defined by the <code>CosTransactions::Status</code>
   * enumeration.
   */
	public static final int STATUS_COMMITTED = 3;

  /**
   * Code <code>StatusRolledBack</code> defined by the <code>CosTransactions::Status</code>
   * enumeration.
   */
	public static final int STATUS_ROLLED_BACK = 4;

  /**
   * Code <code>StatusUnknown</code> defined by the <code>CosTransactions::Status</code>
   * enumeration.
   */
	public static final int STATUS_UNKNOWN = 5;

  /**
   * Code <code>StatusNoTransaction</code> defined by the <code>CosTransactions::Status</code>
   * enumeration.
   */
	public static final int STATUS_NO_TRANSACTION = 6;

  /**
   * Code <code>StatusPreparing</code> defined by the <code>CosTransactions::Status</code>
   * enumeration.
   */
	public static final int STATUS_PREPARING = 7;

  /**
   * Code <code>StatusCommitting</code> defined by the <code>CosTransactions::Status</code>
   * enumeration.
   */
	public static final int STATUS_COMMITTING = 8;

  /**
   * Code <code>StatusRollingBack</code> defined by the <code>CosTransactions::Status</code>
   * enumeration.
   */
	public static final int STATUS_ROLLING_BACK = 9;

	/**
	 * Constructor: Don't let'em create instances.
	 */
	private OTS() {}

	/**
	 * Get the calling {@link Thread}'s current transaction.
	 */
	public static Current getCurrent() {
    return CurrentImpl.getCurrent();
  }
}
